package jdk8.stream;

import java.util.Arrays;

public class SimpleStreamDemo {

	public static void main(String[] args) {
		Integer[] intArr = {90,-1,18,-5,-13,-9,118,45,23,45,-17};
		//统计正整数的个数
		int count = 0;
		for(int i =0;i<intArr.length;i++) {
			//
			if(intArr[i] > 0) {
				count++;
			}
		}
		System.out.println("正整数个数："+count);
		//
		System.out.println("---------------------- 流式编程 ----------------------------");
		//1.要把数组转换成 流[stream]
		long size = Arrays.stream(intArr).filter( (element) -> element > 0).count();
		System.out.println("正整数个数："+size);
	}
}
